<template>
	<view>
		<view style="width: 694rpx;padding: 40rpx 0rpx 40rpx 40rpx;box-sizing: border-box;background: #FFFFFF;border-radius:30rpx ;margin:27.77rpx;">
			<view v-for="(itme,index) in shuju" :key="index">
				<view style="display: flex;">
					<view>
						<image :src="itme.map.userinfo.avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;border: 0.5rpx solid #D5D5D5;"></image>
					</view>
					<view style="margin-left: 20rpx;">
						<view style="font-size: 32rpx;font-weight: bold;">{{itme.map.userinfo.nick_name}}</view>
						<view style="display: flex;align-items: center;height: 30rpx;">
							<view style="height: 30rpx;">
								<van-rate :value="itme.average_score" allow-half :size="18"></van-rate>
							</view>
							<view style="color: #3688FF;font-size: 30rpx;height: 30rpx;position: relative;top: 8rpx;left: 10rpx;">
								{{itme.average_score}}
							</view>
						</view>
						<view style="color: #FF7300;font-size: 20rpx;margin-top: 10rpx;">{{itme.create_time}}</view>
					</view>
				</view>
				<view style="font-size: 30rpx;letter-spacing: 0.5rpx;margin-top: 10rpx;">
					{{itme.content}}
				</view>
				<view style="display: flex;flex-wrap: wrap;">
					<view v-for="(itmes,indexs) in itme.img_list" :key="indexs" style="margin: 40rpx 47rpx 20rpx 0;">
						<image :src="itmes" style="width: 170rpx;height: 170rpx;border-radius: 20rpx;border-radius: 10rpx;border: 0.5rpx solid #D5D5D5;" @tap.stop="gochakan(itme.img_list,indexs)"></image>
					</view>
				</view>
				<view style="height: 2rpx;background: #F5F5F5;margin:0 0 20rpx 0;width: 595rpx;"></view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				appointment_id: "",
				currentPage: 1,
				shuju: [],
				res_: 1
			}
		},
		onReachBottom(){
			if(this.res_ == 1){
				this.currentPage++
				this.pinglun()
			}
		},
		methods:{
			gochakan(itme,index){
				uni.previewImage({
					urls: itme,
					indicator: "number",
					current: index   
				 })
			},
		async	pinglun(){
				const res = await this.$myRequest({
					url: "/masterComment/queryListPage",
					data: {
						appointment_id: this.appointment_id,
						type: "teach_paypal_course",
						currentPage: this.currentPage,
						pageSize: 10
					}
				})
				if(res.code == 0){
					if(res.data.length > 0){
						res.data.forEach((itme) => {
							if(itme.photo_url.indexOf(",") != -1){
								itme.img_list = itme.photo_url.split(",")
							}else{
								let a = []
								a.push(itme.photo_url)
								itme.img_list = a
							}
						})
					}else{
						this.res_ = 2
					}
					if(this.shuju.length == 0){
						this.shuju = res.data
					}else{
						this.shuju = this.shuju.concat(res.data)
					}
				}
			}
		},
		onLoad(option) {
			 const item = JSON.parse(decodeURIComponent(option.num))
			 this.appointment_id = item.appointment_id
			 this.pinglun()
		}
	}
</script>
<style lang="scss" scoped>
	
</style>